package com18;

import javax.servlet.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.LogRecord;

public class oneFilter implements Filter {

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        String age=servletRequest.getParameter("age");
        if (Integer.valueOf(age)<70)
        {
            filterChain.doFilter(servletRequest,servletResponse);
        }
        else
        {
            servletResponse.setContentType("text/html;charset=utf-8");
            PrintWriter out=servletResponse.getWriter();
            out.write("大爷，珍爱生命");
        }
    }
}
